package by.pavlyukevich.paymentsystem.datamodel.payment;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import by.pavlyukevich.paymentsystem.datamodel.AbstractEntity;
import by.pavlyukevich.paymentsystem.datamodel.erip.PaymentTree;
import by.pavlyukevich.paymentsystem.datamodel.user.Contractor;

@Entity
public class PaymentType extends AbstractEntity<Integer> {

	@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
	private Contractor		contractor;

	@ManyToOne(fetch = FetchType.LAZY, cascade = { CascadeType.REFRESH })
	private PaymentTree		paymentTree;

	@Column
	private String			name;

	@OneToMany(mappedBy = "paymentType", cascade = { CascadeType.ALL }, orphanRemoval = true)
	private Set<CalcScheme>	calcSchemes;

	public Set<CalcScheme> getCalcSchemes() {
		return calcSchemes;
	}

	public void setCalcSchemes(Set<CalcScheme> calcSchemes) {
		this.calcSchemes = calcSchemes;
	}

	public Contractor getContractor() {
		return contractor;
	}

	public void setContractor(Contractor contractor) {
		this.contractor = contractor;
	}

	public PaymentTree getPaymentTree() {
		return paymentTree;
	}

	public void setPaymentTree(PaymentTree paymentTree) {
		this.paymentTree = paymentTree;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
